package com.qianfeng.qlm.handforireader.model;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by LinXiangLin on 2015/3/24.
 */
public class NewBeanList {



    List<NewBean> dataList;

    public void parseJson(JSONObject jsonObject){

        if (jsonObject != null){
            try {
                JSONArray newComicArr = jsonObject.getJSONArray("new_comic_arr");
                if (newComicArr != null){
                    dataList = new ArrayList<>();
                    for (int i = 0; i < newComicArr.length();i++){
                          JSONObject jsonObjectTitle = newComicArr.getJSONObject(i);
                        if (jsonObjectTitle != null){
                            JSONArray comicArr = jsonObjectTitle.getJSONArray("comic_arr");
                            if (comicArr != null){
                              for (int j = 0;j < comicArr.length();j++){
                                  JSONObject comicArrJSONObject = comicArr.getJSONObject(j);
                                  NewBean bean = new NewBean();
                                  bean.setWeek_number(jsonObjectTitle.optString("week_number"));
                                  bean.setTitle_comic_updata_time(jsonObjectTitle.optString("comic_updata_time"));
                                  bean.setShow_time(jsonObjectTitle.optString("show_time"));
                                  bean.setIs_first(jsonObjectTitle.optString("is_first"));
                                  bean.setId(comicArrJSONObject.optString("id"));
                                  bean.setComic_name(comicArrJSONObject.optString("comic_name"));
                                  bean.setComic_desc(comicArrJSONObject.optString("comic_desc"));
                                  bean.setComic_pic_240_320(comicArrJSONObject.optString("comic_pic_240_320"));
                                  bean.setPainter_user_id(comicArrJSONObject.optString("painter_user_id"));
                                  bean.setPainter_user_nickname(comicArrJSONObject.optString("painter_user_nickname"));
                                  bean.setComic_pic_240_320(comicArrJSONObject.optString("comic_pic_240_320"));
                                  bean.setComic_last_orderidx(comicArrJSONObject.optString("comic_last_orderidx"));
                                  dataList.add(bean);
                              }



                            }
                        }


                    }
                }


            } catch (Exception e) {
                e.printStackTrace();
            }
        }

    }


    public List<NewBean> getDataList() {
        return dataList;
    }

    public void setDataList(List<NewBean> dataList) {
        this.dataList = dataList;
    }
}
